# frozen_string_literal: true

class CreateDecisionTableRows < ActiveRecord::Migration[6.0]
  def change
    create_table :decision_table_rows do |t|
      t.integer :decision_table_id, null: false,  limit: 8
      t.integer :ordinal,           null: false,  limit: 4
      t.timestamps                  null: false
    end

    add_index :decision_table_rows, %i[ordinal decision_table_id], unique: true
    add_foreign_key :decision_table_rows, :rule_entities, column: :decision_table_id
  end
end
